package com.zhou.common.mybatis.template.shiro.zhou.controller;

import com.zhou.common.mybatis.template.shiro.zhou.entity.PolicyDynamicElementInsertRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@RestController
public class CacheContoller {

    @Cacheable(value = {"policyLables#3600"}, key = "#applyItemCode")
    public List queryPolicyLables(String applyItemCode) {
        log.info("queryPolicyLables,applyItemCode={}", applyItemCode);
        //TODO执行查询操作
        return new ArrayList();
    }

    @CacheEvict(value = {"policyLables"}, allEntries = true)
    public void removePolicyLablesCache() {
        log.info("清楚政策标签缓存成功");
    }

    @CacheEvict(value = {"policyLables"}, key = "#insertRequest.applyItemCode")
    public void insertPolicyLables(PolicyDynamicElementInsertRequest insertRequest) {
        //TODO执行插入操作
    }

    @CacheEvict(value = {"books-list", "books"}, key = "'*'+#insertRequest.applyItemCode+'*'")
    public void insertPolicyLables1(PolicyDynamicElementInsertRequest insertRequest) {
        //TODO执行插入操作
    }
}
